package fr.unice.polytech.chord.samples;

import java.io.IOException;

import javax.swing.SwingUtilities;

import org.objectweb.proactive.ActiveObjectCreationException;
import org.objectweb.proactive.api.PAActiveObject;

import fr.unice.polytech.chord.core.Tracker;
import fr.unice.polytech.chord.gui.ChordVisualizer;

/**
 * Launch a new {@link ChordVisualizer} graphical user interface.
 * 
 * @author Anthony Parisy
 * @author Laurent Pellegrino
 * @author Marc Valdener
 * 
 * @version 10/30/2009
 */
public class ChordVisualizerLauncher {

	public static void main(String[] args)
			throws ActiveObjectCreationException, IOException {
		if (args.length != 1) {
			System.err.println("Usage : "
					+ ChordVisualizerLauncher.class.getCanonicalName()
					+ " trackerURI");
			System.exit(1);
		}

		String trackerURI = args[0];

		final Tracker remoteTrackerRef = (Tracker) PAActiveObject.lookupActive(
				Tracker.class.getCanonicalName(), trackerURI);

		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				new ChordVisualizer(remoteTrackerRef).createAndShowGUI();
			}
		});
	}
}
